# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=kibi
pkgver=0.2.2
pkgrel=0
pkgdesc="A text editor in ≤1024 lines of code, written in Rust"
url="https://github.com/ilai-deutel/kibi"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le"  # limited by rust/cargo
license="(Apache-2.0 OR MIT) AND BSD-2-Clause"
makedepends="cargo"
source="https://github.com/ilai-deutel/kibi/archive/v$pkgver/$pkgname-$pkgver.tar.gz"

prepare() {
	default_prepare

	# Optimize binary for size.
	cat >> Cargo.toml <<-EOF

		[profile.release]
		codegen-units = 1
		lto = true
		opt-level = "z"
		panic = "abort"
	EOF
}

build() {
	cargo build --release --locked
}

check() {
	cargo test --locked
}

package() {
	cargo install --locked --path . --root="$pkgdir/usr"
	rm "$pkgdir"/usr/.crates*
}

sha512sums="da618363e38208140ec793c11a220ba32021683dd8e26874c0910f1194d9bdf9e7b5cda79ef29190944743abe31f18e8eed969b3f5466d1b82a31e09b2c7c225  kibi-0.2.2.tar.gz"
